import {createRouter, createWebHistory} from 'vue-router';
import HelloWorld from "@/components/HelloWorld.vue";
import login from "@/components/login.vue";
import main from "@/components/main.vue";
import userManage from "@/components/userManage.vue";
import dataShow from "@/components/dataShow.vue";
import roleManage from "@/components/roleManage.vue";
import serverManage from "@/components/serverManage.vue";
import taskManage from "@/components/taskManage.vue";

const routes = [//添加路由对象//
    {
        path: '/login',  // 访问的路由地址
        name: 'login',
        component: login,  // 引入的组件名称
        // meta: [{requiresAuth: true}]  // 需要登录权限
    },
    {
        path: '/main',
        name: 'main',
        component: main,
        meta: [{requiresAuth: true}],
        children: [
            {path: '/', name: 'dataShow', component: dataShow},
            {path: '/userManage', name: 'userManage', component: userManage},
            {path: '/roleManage', name: 'roleManage', component: roleManage},
            {path: '/serverManage', name: 'serverManage', component: serverManage},
            {path: '/taskManage', name: 'taskManage', component: taskManage}

        ]
    }
]


const router = createRouter({
    history: createWebHistory(),
    routes
});

export default router;